/**
* Created with IntelliJ IDEA.
* Description:
* User: zhongyisheng
* Date: 2024-06-30
* Time: 15:08
*/
class Student{
    //字段 属性 成员变量  ：定义的类当中，方法外面
    public String name;
    public int age;

    public String setName(String name) {
        return this.name = name;
    }
    public void print() {
        this.show();
    }
    public void show() {
        System.out.println("name "+ name);
        System.out.println("age "+ age);
    }

    public void eat() {
        System.out.println(name + " 在吃饭");
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }
}
public class Test{
    public static void main(String[] args) {
        Student student = new Student("小啊鳄",12);
        student.setName("小啊鳄");
        student.print();
    }
//    public static void main1(String[] args) {
//        Student student = new Student();//通过new关键字进行实例化
//        student.name = "小啊鳄";// 通过 对象名. 号进行赋值
//        student.age = 18;
//        student.show();//调用成员方法
//        student.eat();
//
//        Student student2 = new Student();//通过new关键字进行实例化
//        student.name = "大啊鳄";// 通过 对象名. 号进行赋值
//        student.age = 28;
//        student.show();//调用成员方法
//        student.eat();
//    }
}
